﻿using Microsoft.AspNetCore.Mvc;
using ST.Buz.Base.ViewModel;
using ST.Common.Util.Mvc;
using System.Collections.Generic;

namespace ST.Buz.Web.Components
{
	public class AdminMenuViewComponent : BaseViewComponent
	{
		//public async Task<IViewComponentResult> InvokeAsync()
		//{
		//	return View();
		//}

		public override IViewComponentResult Invoke()
		{
			try
			{
				//UserSession sessionCurrent = GetSessionFromRequest();
				//todo:根据用户权限过滤
				ViewBag.Menus = GetMenus();
				return View();
			}
			catch (AuthException ex)
			{
				throw ex;
			}
		}

		protected List<VM_Sys_ModuleService> GetMenus()
		{
			List<VM_Sys_ModuleService> lst = new List<VM_Sys_ModuleService>()
			{
				new VM_Sys_ModuleService()
				{
					Name = "基本设置",
					Children = new List<VM_Sys_ModuleService>()
					{
						new VM_Sys_ModuleService(){
							Name="系统参数",
							Url=Url.Action("List","Sys_EnumCode"),
							Icon="icon-setting",
							Code="37FB4C60B8"
						}
						,new VM_Sys_ModuleService(){
							Name="业务编码",
							Url=Url.Action("List","Sys_BuzRowNum"),
							Icon="icon-bianma",
							Code="D735E0ED93"
						}
						//,new VM_Sys_ModuleService(){
						//	Name="打印模板",
						//	Url=Url.Action("List","Sys_PrintTpl"),
						//	Icon="icon-print",
						//	Code="AB710645A9"
						//}
						,new VM_Sys_ModuleService(){
							Name="应用管理",
							Url=Url.Action("List","WX_AppConfig"),
							Icon="icon-app",
							Code="A2B25492F6"
						}
						,new VM_Sys_ModuleService(){
							Name="模板消息",
							Url=Url.Action("List","WX_TplMsgConfig"),
							Icon="icon-xiaoxi",
							Code="DA8EE90DAC"
						}
					}
				}
				//,new VM_Sys_ModuleService()
				//{
				//	Name = "系统设置",
				//	Children = new List<VM_Sys_ModuleService>()
				//	{
				//		new VM_Sys_ModuleService(){
				//			Name="数据库备份",
				//			Url=Url.Action("DBBackupList","Sys"),
				//			Icon="icon-beifen",
				//			Code="FB13E59B9E"
				//		}
				//	}
				//}
			};
			return lst;
		}
	}
}
